<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui"
	template="/templates/masterLayout.xhtml">

	<ui:define name="pageTitle">#{out.partners_title}</ui:define>
	<ui:define name="header"> -> #{out.importers_title}</ui:define>

	<ui:define name="head-extra">
	</ui:define>

	<ui:define name="content">

		<h:form id="materialNeedForm">
			<p:growl id="msgs" showDetail="true" />
			<p:dataTable id="materialNeedTable" var="currentNeed"
				value="#{importerNecessaryMaterials.materialNeeds}" paginator="true"
				rows="10" filteredValue="#{importerNecessaryMaterials.filtered}"
				paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
				rowsPerPageTemplate="5,10,15" emptyMessage="#{out.empty_message}">

				<p:column headerText="#{out.materials_table_name}"
					sortBy="#{currentNeed.materialName}"
					filterBy="#{currentNeed.materialName}">
					<h:outputText value="#{currentNeed.materialName}" />
				</p:column>
				<p:column headerText="#{out.worker_order_quantity}"
					sortBy="#{currentNeed.quantity}" filterBy="#{currentNeed.quantity}">
					<h:outputText value="#{currentNeed.quantity}" />
				</p:column>
			</p:dataTable>
		</h:form>
		<h:form id="materialNeedCommandsForm">
			<h:panelGrid columns="4" cellpadding="5">
				<h:outputLabel value="#{out.importer_table_export}: ">
				</h:outputLabel>
				<h:commandLink>
					<p:graphicImage name="/images/xls.png" width="64" />
					<p:dataExporter type="xls" encoding="utf-8"
						postProcessor="#{importerNecessaryMaterials.postProcessXLS}"
						target=":materialNeedForm:materialNeedTable"
						fileName="#{importerNecessaryMaterials.getXLSFileName()}" />
				</h:commandLink>
				<h:commandLink>
					<p:graphicImage name="/images/csv.png" width="64" />
					<p:dataExporter type="csv" encoding="utf-8"
						target=":materialNeedForm:materialNeedTable"
						fileName="#{importerNecessaryMaterials.getXLSFileName()}" />
				</h:commandLink>
			</h:panelGrid>
		</h:form>

	</ui:define>

</ui:composition>